<?

include_once("codelibrary/inc/variables.php");

include_once("session.php");
include_once('codelibrary/inc/reports.php');

$from = $_GET['fromdate'];
$to = $_GET['todate'];
$day = (60 * 60 * 24);
if($fromdate == '') {
	$fromdate = date("Y-m-d",mktime() - ($day * 15));
}

if($todate == '') {
	$todate = date("Y-m-d",mktime() + ($day * 15));
}

$staff = $_REQUEST['staff_id'];
$status = $_REQUEST['apptstatus'];
$service = $_REQUEST['service_id'];
$customer = $_REQUEST['customer_id'];

if($staff==0) {
	$staff = '';
}
if($status==0) {
	$status = '';
}
if($service==0) {
	$service = '';
}
if($customer==0) {
	$customer = '';
}

$logintype = $_SESSION['logintype'];

if($logintype=="user") {
	$cus = getCustomerData($_SESSION['customer_id']);
	$cusname = $cus->firstname." ".$cus->lastname;
}

if($logintype=="staff") {
	$stf = getStaffData($_SESSION['staff_id']);
	$staffname = $stf->first_name." ".$stf->last_name;
}

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html dir="LTR" lang="en">



<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">



<title>Online Appointment</title>



<base >

<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script type="text/javascript" src="codelibrary/js/calendarDateInput.js"></script>
<script type="text/javascript" src="codelibrary/js/prototype.js"></script>
<script type="text/javascript" src="codelibrary/js/reports.js"></script>
<title>Staff Management</title>
</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">





<table cellpadding="0" cellspacing="0" border="0"><tr>

  <td style="background:url(images/top.gif) repeat-x top; ">

<table cellpadding="0" cellspacing="0" border="0" style="width:764px" align="center"> 

	<tr>

		<td>

			<table cellpadding="0" cellspacing="0" border="0" style="height:57">

				<tr>

					<td height="57">

<? html_header(); ?>					</td>

				</tr>

			</table>





		</td>

	</tr>

	<tr>

		<td>











<table border="0" width="105%" cellspacing="0" cellpadding="0">

  <tr>

    <td valign="top" class="col_left">



<table border="0"cellspacing="0" cellpadding="0" class="box_width_left">

	<tr><td width="100%">

		<table border="0" cellspacing="0" cellpadding="0">

<tr><td>



<table border="0" width="100%" cellspacing="0" cellpadding="0" class="">

  <tr>

    <td>

    <table border="0" width="100%" cellspacing="0" cellpadding="0"  class="" height="91">

  <tr>

    <td align="center" height="91">

    <img border="0" src="images/logo.jpg" width="208" height="86"></td>

  </tr>

</table>

</td>

  </tr>

</table>

</td></tr>





          <tr>

            <td>

<table border="0" width="100%" cellspacing="0" cellpadding="0"  class="box_header_txt" height="48">

  <tr>

    <td style="background-image: url(images/1_bg2-2.gif)" height="1">

      <p style="margin-top: 16"> </td>

  </tr>

</table>

<table border="0" width="100%" cellspacing="0" cellpadding="0"   style="border-bottom:12px solid #ffffff;">

  <tr>

    <td>

    <table border="0" width="100%" cellspacing="0" cellpadding="0"  style="margin-bottom:0px;background:#7C7C7C url(images/1_line.gif) no-repeat left bottom;" >

  <tr>

    <td  style="padding:3px 16px 8px 25px;">

      <table width="100%" border="0">

        <tr>

          <td>&nbsp;</td>

          <td>&nbsp;</td>

        </tr>

        <tr>

          <td>&nbsp;</td>

          <td>&nbsp;</td>

        </tr>

      </table>

    </td>

  </tr>

</table>

</td>

  </tr>

</table>

            </td>

          </tr>





          <tr>

            <td class="">&nbsp;

</td>

          </tr>



		</table>

	</td>

	<td><img src="images/spacer.gif" border="0" alt="" width="15" height="1"></td></tr>

</table>



    </td>



    <td width="100%" valign="top">

<table border="0" width="100%" cellspacing="0" cellpadding="0"  class="cont_header_txt">

  <tr>

    <td><table border="0" cellpadding="0" cellspacing="0" bgcolor="#EAEAEA" class="cont_header_txt">
      <tr>
        <td><img src="images/1_q1.gif" border="0" alt="a" width="45" height="39"></td>
        <td style="width:100%">Appointment reports </td>
        <td><img src="images/1_q2.gif" border="0" alt="s" width="10" height="39"></td>
      </tr>
    </table></td>

  </tr>

</table>





						

						<table cellpadding="0" cellspacing="0" border="0" style="border:0px solid #DEDEDE; border-width:0px 1px 0px 1px;">

                          <tr>

                            <td style="background:#ffffff;border:0px solid #ffffff; border-width:18px 5px 10px 5px;"><!-- new_products //-->

                                <table border="0" width="" cellspacing="0" cellpadding="0" class="box_width_cont product">

                                  <tr>

                                    <td>
									<form name="searchfrm" method="GET" action="reports-view-details.php">
									<table width="100%" border="0" cellspacing="4" cellpadding="4">
                                      <tr>
                                        <td colspan="4"><strong>Select Filter</strong> </td>
                                      </tr>
                                      <tr>
                                        <td>From Date </td>
                                        <td><script>DateInput('fromdate', true, 'YYYY-MM-DD'<? if($fromdate!="") { echo ",'".date("Y-m-d",strtotime($fromdate))."'"; } ?>)</script></td>
                                        <td>To Date </td>
                                        <td><script>DateInput('todate', true, 'YYYY-MM-DD'<? if($todate!="") { echo ",'".date("Y-m-d",strtotime($todate))."'"; } ?>)</script></td>
                                      </tr>
                                      <tr>
                                        <td>Status</td>
                                        <td><? statusListForm($status) ?></td>
                                        <td>Service</td>
                                        <td><? serviceListForm($service); ?></td>
                                      </tr>
                                      <tr>
                                        <td>Staff Name </td>
                                        <td><span class="tablecells">
                                          <? 
										  if($staffname == '') {
										  staffListForm($staff);
										  } else {
										  	echo $staffname;
										  }
									 
										  
										  ?>
                                        </span></td>
                                        <td>Customer Name </td>
                                        <td><span class="tablecells">
                                          <? 
										  if($cusname=="") {
										  customerListForm($customer,1); 
										  } else {
										  	echo $cusname;
										  }
										  ?>
                                        </span></td>
                                      </tr>
                                      <tr>
                                        <td colspan="4"><span class="smallText">
                                          <input name="Submit" type="submit" class="button" id="Submit" value="Apply Filters">
                                        </span></td>
                                      </tr>
                                    </table>
									</form>

                                  </tr>
                                  <tr>
                                    <td><br />
									<?
									appointment_grid($fromdate, $todate, $status, $service, $staff, $customer);
									?>
									</td>
                                  </tr>
                                </table>
							
                              <table border="0" cellspacing="0" cellpadding="0" align="center" class="box_width_cont product">

                                  <tr>

                                    <td></td>

                                  </tr>

                            </table></td>

                          </tr>

                        </table>

						

						<table cellpadding="0" cellspacing="0" border="0">

							<tr>

								<td><img src="images/1_q4.gif" border="0" alt="" width="10" height="10"></td>

								<td style="width:100%; background-image:url(images/1_li1.gif)"></td>

								<td><img src="images/1_q3.gif" border="0" alt="" width="10" height="10"></td>

							</tr>

						</table>

						





		

		

		</td>



    <td class="col_right">



<table border="0"cellspacing="0" cellpadding="0" class="box_width_right">

	<tr><td></td>

		<td width="100%">

			<table border="0" cellspacing="0" cellpadding="0">

				<tr><td></td></tr>

			</table>

		</td>

	</tr>

</table>





    </td>

  </tr>

</table>







		</td>

	</tr>

	<tr>

		<td>

			<table cellpadding="0" cellspacing="0" border="0" style="height:98px; background-image:url(images/bot.gif)">

				<tr>

					<td>

						<table cellpadding="0" cellspacing="0" border="0" class="footer">

							<tr>									

								<td height="77"><img src="images/spacer.gif" border="0" alt="" width="25" height="1"></td>				

								<td style="width:207px"><br style="line-height:49px"><img src="images/p1.gif" border="0" alt="" width="145" height="24"><br></td>

							  <td style="width:532px">&nbsp;</td>

							</tr>

						</table>

					</td>

				</tr>

			</table>

		</td>

	</tr>

</table></td></tr></table>

<table border="0" width="100%" cellspacing="0" cellpadding="0">

  <tr>

    <td align="center"></td>

  </tr>

</table>

</body>



</html>